package com.twu.biblioteca;

import java.io.PrintStream;

/**
 * Created with IntelliJ IDEA.
 * User: thoughtworker
 * Date: 10/9/13
 * Time: 3:35 PM
 * To change this template use File | Settings | File Templates.
 */
public class Book {

    private String title;
    private boolean isReserved;
    private PrintStream printer;

    public Book(String title, PrintStream printer) {
        this.title = title;
        this.isReserved = false;
        this.printer = printer;
    }

    public void reserve() {
        if (!isReserved){
            isReserved = true;
        }
        else{
           printer.println("Sorry, the book is already reserved");
        }
    }

    public boolean isTheBookReserved() {
        return isReserved;
    }

    public String getTitle() {
        return title;
    }
}
